package com.cn.mq.controller;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cn.mq.message.Message;
import com.cn.mq.produce.Produce;
import com.cn.mq.produce.TopicProduce;

/**
 * @ClassName: RabbitmqController
 * @Description: TODO
 * @author Administrator
 * @date 2017年7月4日
 */
@RestController
public class RabbitmqController {
	@Autowired
	private Produce produce;
	@Autowired
	private TopicProduce produce2;

	@GetMapping("/send")
	public String send(String msg) {
		Message message=new Message();
		message.setId(UUID.randomUUID().toString());
		message.setText(msg);
		produce.send(message);
		return "Send OK.";
	}
	@GetMapping("/send2")
	public String send2(String msg) {
		Message message=new Message();
		message.setId(UUID.randomUUID().toString());
		message.setText(msg);
		produce2.send(message);
		return "Send OK.";
	}
}
